<!DOCTYPE html>
<html>
<head>
    <title>Viewport 'height' descriptor has 'extend-to-zoom' value</title>
    <script src="../../resources/testharness.js"></script>
    <script src="../../resources/testharnessreport.js"></script>
    <style>
        html, body { width: 100%; height: 100%; margin: 0 }
        @viewport { height: -internal-extend-to-zoom; zoom: 2.0; }
    </style>
    <script>
        test(function(){
            assert_own_property(window, "testRunner");
        }, "Check that window.testRunner is present. Required to add a user stylesheet.");

        if (window.testRunner) {
            testRunner.injectStyleSheet("@viewport { width: -internal-extend-to-zoom 980px; min-zoom: 0.25; max-zoom: 5; height: auto ; zoom: auto; user-zoom: zoom; orientation: auto }", true);
        }
    </script>
</head>
<body>
    <div id="log"></div>
    <script>
        test(function(){
            assert_own_property(window, "internals");
        }, "Check that window.internals is present. Required to call viewportAsText.");

        var actualWidth;
        var actualHeight;

        var vpString = internals.viewportAsText(document, 1, 320, 352);
        var match = /viewport size (.+)x(.+) scale (.+ )/.exec(vpString);

        if (match) {
            actualHeight = parseFloat(match[2]);
        }

        test(function(){
            assert_equals(actualHeight, 176);
        }, "Check viewport height.");
    </script>
</body>
</html>
